home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Very Best of Atari Inside
/
The Very Best of Atari Inside 1.iso
/
mint
/
mntlb20
/
lib
/
gcrt0.s
< prev
next >
Wrap
Text File
|
1992-03-17
|
2KB
|
70 lines
| gcrt0.o: linked in when profiling is enabled
|
| Initilization code; this is common to both 16 and 32 bit libraries,
| so be careful!
|
.globl __app | short, declared in crtinit.c
.globl __base | BASEPAGE *, declared in crtinit.c
.globl __heapbase | void *
.globl __stksize | long, declared by user or in stack.c
|
| Assumption: programs always start with a0 == 0, accessories with
| a0 == basepage
|
.text
.even
.globl __start
__start:
subl a6, a6 | clear a6 for debuggers
cmpw #0, a0 | test if acc or program
beq __startprg | if a program, go elsewhere
movel a0, __base | acc basepage is in A0
lea a0@(252), sp | use command line as a temporary stack
jmp __acc_main | function is in crtinit.c
|
| program startup code: doesn't actually do much, other than push
| the basepage onto the stack and call _start1 in crtinit.c
|
__startprg:
movel sp@(4), a0 | get basepage
movel a0, __base | save it
movel a0@(4), d0 | get _base->p_hitpa
andl #0xfffffffe, d0 | round off
movel d0, sp | set stack (temporarily)
jmp __crtinit | in crtinit.c
|
| _setstack: changes the stack pointer; called as
| void setstack( void *newsp )
| called from crtinit.c once the new stack size has been decided upon
|
| WARNING WARNING WARNING: after you do this, local variables may no longer
| be accessible!
| destroys a0 and a7
.globl __setstack
__setstack:
movel sp@+, a0 | save return address
movel sp@+, sp | new stack pointer
jmp a0@ | back to caller
|
| interfaces for gprof: for crt0.s, does nothing, but for gcrt0.s branches
| to the appropriate subroutines
|
.globl __monstartup
.globl _monstartup
.globl ___mcleanup
.globl __mcleanup
.globl __moncontrol
.globl _moncontrol
__monstartup:
jmp _monstartup
__moncontrol:
jmp _moncontrol
___mcleanup:
jmp __mcleanup